//
//  YMUILabel.m
//  PinGJByOwnerSide
//
//  Created by lantaiyuan on 2017/11/10.
//  Copyright © 2017年 lantaiyuan. All rights reserved.
//

#import "YMUILabel.h"

@implementation YMUILabel

- (void)setText:(NSString *)text{
    [super setText:text];
    NSString * str = [text substringFromIndex:text.length - 1];
    [self changeLabel:self subString:str font:[UIFont systemFontOfSize:14]];
}

-(void) changeLabel:(UILabel *)label subString:(NSString *)subString font:(UIFont *)font
{
    NSRange range = [label.text rangeOfString:subString];
    
    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:label.text];
    [attrString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"#b5f4c6"] range:range];
    [attrString addAttribute:NSFontAttributeName value:font range:range];
    
    label.attributedText = attrString;
}

@end
